package edu.uoc.tdp.pac4.beans;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.sql.Date;




public class Course implements Serializable {
	
	
	 private static final long serialVersionUID = 1L;

	    private int courseCode;
	    private String courseName;
	    private int reqAttendance;
	    private int credits;	   
	    private String plaEstudis;
	    private String plaDocent;
	    private String bibliography;
	    
	    private Date inactivityDate=null;

	/**
	* Builder of the class Course
	* @param courseCode, code of the course
	* @param reqAttendance, min % required to gain the course
	* @param credits, number of credits of the course
	* @param plaEstudis, degree at which the course is related to
	* @param plaDocent, describes how the course is carried out
	* @param bibliography, list of sources of information for the course
	* @param inactivityDate, indicates date since course has got inactive, no date means course is active
	*/

	public Course(int code, String name,int reqAtt, int crs, String plaE, String plaD, String bibl){
			this.courseCode=code;
			this.courseName=name;
			this.reqAttendance=reqAtt;
			this.credits=crs;			
			this.plaEstudis=plaE;
			this.plaDocent=plaD;
			this.bibliography=bibl;
			
			
			
	}


	public Course() {
		// TODO Auto-generated constructor stub
	}


	public int getCourseCode() {
		return courseCode;
	}


	public void setCourseCode(int code) {
		this.courseCode=code;
	}


	public String getCourseName() {
		return courseName;
	}


	public void setCourseName(String name) {
		this.courseName=name;
	}


	public int getReqAttendance() {
		return reqAttendance;
	}


	public void setReqAttendance(int reqAtt) {
		this.reqAttendance=reqAtt;
	}
	
	public int getCredits() {
		return credits;
	}


	public void setCredits(int crs) {
		this.credits=crs;
	}
	
	
	

	public String getPlaEstudis() {
		return plaEstudis;
	}


	public void setPlaEstudis(String plaE) {
		this.plaEstudis=plaE;
	}
	
	public String getPlaDocent() {
		return plaDocent;
	}


	public void setPlaDocent(String plaD) {
		this.plaDocent=plaD;
	}
	
	public String getBibliography() {
		return bibliography;
	}


	public void setBibliography(String bibl) {
		this.bibliography=bibl;
	}
	

	
	


	/**
	 * Method that change activity status of the course
	 * If no inactivity date exists, current day is set as inactivity date
	 * In case of change from inactive to active, inactivityDate is left as null
	 * @param act
	 */
	
	public Date getInactivityDate() {
		return inactivityDate;
	}
	public void setInactivityDate(Date date) {
		this.inactivityDate=date;
	}


	public boolean isActive() {
		if(inactivityDate == null){
			return true;
		}
		return false;
		
	}
	
	
}
